{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body" pad15>
        <div class="layui-form" wid100 lay-filter="">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">LOGO</label>
                <div class="layui-input-block">
                    {:get_field('image',isset($data.logo)?$data.logo:'','logo','logo')}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">机构名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}"  class="layui-input" autocomplete="off">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联 系 人</label>
                <div class="layui-input-block">
                    <input type="text" name="contact" value="{$data.contact|default=''}"  class="layui-input" autocomplete="off">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" value="{$data.mobile|default=''}"  class="layui-input" autocomplete="off">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">所在省市</label>
                <div class="layui-input-block">
                    <input id="demoCascader1" name="shengshi" value="{$data.province|default=''},{$data.city|default=''},{$data.area|default=''}" placeholder="请选择" class="layui-hide"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-input-block">
                    <input type="text" name="address" value="{$data.address|default=''}"  class="layui-input" autocomplete="off">
                    <input type="hidden" name="lat"  id="datalat" value="{$data.lat|default=''}" autocomplete="off" class="layui-input">
                    <input type="hidden" name="lng" id="datalng" value="{$data.lng|default=''}" autocomplete="off" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-position" id="btnDialog6"><i class="fa fa-location"></i> 坐标选择</button>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea">{$data.remark|default=''}</textarea>
                </div>
            </div>
            
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input name="province" type="hidden"><input name="city" type="hidden"><input name="area" type="hidden">
                    <button class="layui-btn" lay-submit  lay-filter="*">确认保存</button>
                </div>
            </div>
        </form>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/hqui/module/cascader/citys-data.js"></script>
<script>
    layui.use(['cascader'], function () {
        var $ = layui.jquery;
        var cascader = layui.cascader;
        var admin = layui.admin;
        
        // value也是中文而不是区号
        var data = cascader.getCityData(admin.util.deepClone(citysData));
        cascader.render({
            elem: '#demoCascader1',
            data: data
        });

    });
    layui.use(['layer', 'admin', 'form', 'laydate', 'fileChoose'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var admin = layui.admin;
        var laydate = layui.laydate;
        var form = layui.form;
        var fileChoose = layui.fileChoose;

     
        // 地图选择位置
        $('#btnDialog6').click(function () {
            admin.chooseLocation({
                needCity: true,
                onSelect: function (res) {
                    console.log(res)
                    $('input[name="address"]').val(res.address);
                    $('input[name="lat"]').val(res.lat);
                    $('input[name="lng"]').val(res.lng);
                }
            });
        });

    });
</script>
{/block}